import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { User } from '../types/user.d'
export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref<User>()

    const setUser = (u: User) => {
      user.value = u
    }

    const deleUser = () => {
      user.value = undefined
    }

    const urls = ref('')
    const updateUrl = (url: string) => (urls.value = url)

    return { user, setUser, deleUser, urls, updateUrl }
  },
  {
    persist: true
  }
)
